-- Operation
CREATE TABLE Operation (
Operation_Id integer NOT NULL,
Description varchar(50) NOT NULL 
);
GO

ALTER TABLE Operation
ADD CONSTRAINT PK_Operation
PRIMARY KEY (Operation_Id);
GO

ALTER TABLE Operation 
ADD CONSTRAINT UNQ_Operation_Description
UNIQUE (Description);
GO

INSERT INTO Operation (Operation_Id, Description) VALUES (0,'INSERT');
GO
INSERT INTO Operation (Operation_Id, Description) VALUES (1,'UPDATE');
GO
INSERT INTO Operation (Operation_Id, Description) VALUES (2,'DELETE');
GO

-- Status
CREATE TABLE Status (
Status_Id integer NOT NULL,
Description varchar(50) NOT NULL
);
GO

ALTER TABLE Status
ADD CONSTRAINT PK_Status
PRIMARY KEY (Status_Id);
GO

ALTER TABLE Status 
ADD CONSTRAINT UNQ_Status_Description
UNIQUE (Description);
GO

INSERT INTO Status (Status_Id, Description) VALUES (0,'ACTIVE');
GO

INSERT INTO Status (Status_Id, Description) VALUES (1,'INACTIVE');
GO

INSERT INTO Status (Status_Id,Description) VALUES (2,'DELETED');
GO

CREATE TABLE Rating (
Rating_Id integer NOT NULL,
Description varchar(50) NOT NULL
);
GO

ALTER TABLE Rating
ADD CONSTRAINT PK_Rating
PRIMARY KEY (Rating_Id);
GO

ALTER TABLE Rating 
ADD CONSTRAINT UNQ_Rating_Description
UNIQUE (Description);
GO

INSERT INTO Rating (Rating_Id, Description) VALUES (0,'Not Rated');
GO

INSERT INTO Rating (Rating_Id, Description) VALUES (1,'Poor');
GO

INSERT INTO Rating (Rating_Id, Description) VALUES (2,'Fair');
GO

INSERT INTO Rating (Rating_Id,Description) VALUES (3,'Good');
GO

INSERT INTO Rating (Rating_Id,Description) VALUES (4,'Very Good');
GO

INSERT INTO Rating (Rating_Id,Description) VALUES (5,'Excellent');
GO

-- Country
CREATE TABLE Country (
Country_Id integer NOT NULL,
Code varchar(3) NOT NULL,
Description varchar(100) NOT NULL
);
GO

ALTER TABLE Country
ADD CONSTRAINT PK_Country
PRIMARY KEY (Country_Id);
GO

INSERT INTO Country (Country_Id,Code,Description) VALUES (1,'AFG','Afghanistan');   
go                 
INSERT INTO Country (Country_Id,Code,Description) VALUES (2,'ALB','Albania'); 
go                                    
INSERT INTO Country (Country_Id,Code,Description) VALUES (3,'DZA','Algeria');    
go                                
INSERT INTO Country (Country_Id,Code,Description) VALUES (4,'ASM','American Samoa');  
go                   
INSERT INTO Country (Country_Id,Code,Description) VALUES (5,'AND','Andorra');   
go                               
INSERT INTO Country (Country_Id,Code,Description) VALUES (6,'AGO','Angola');     
go                               
INSERT INTO Country (Country_Id,Code,Description) VALUES (7,'AIA','Anguilla');   
go                                
INSERT INTO Country (Country_Id,Code,Description) VALUES (8,'ATA','Antarctica');     
go                          
INSERT INTO Country (Country_Id,Code,Description) VALUES (9,'ATG','Antigua and Barbuda');   
go          
INSERT INTO Country (Country_Id,Code,Description) VALUES (10,'ARG','Argentina');  
go                              
INSERT INTO Country (Country_Id,Code,Description) VALUES (11,'ARM','Armenia'); 
go                                  
INSERT INTO Country (Country_Id,Code,Description) VALUES (12,'ABW','Aruba');     
go                                 
INSERT INTO Country (Country_Id,Code,Description) VALUES (13,'AUS','Australia');    
go                             
INSERT INTO Country (Country_Id,Code,Description) VALUES (14,'AUT','Austria');  
go                                   
INSERT INTO Country (Country_Id,Code,Description) VALUES (15,'AZE','Azerbaijan');  
go                             
INSERT INTO Country (Country_Id,Code,Description) VALUES (16,'BHS','Bahamas');   
go                                
INSERT INTO Country (Country_Id,Code,Description) VALUES (17,'BHR','Bahrain');  
go                                  
INSERT INTO Country (Country_Id,Code,Description) VALUES (18,'BGD','Bangladesh');  
go                           
INSERT INTO Country (Country_Id,Code,Description) VALUES (19,'BRB','Barbados');   
go                              
INSERT INTO Country (Country_Id,Code,Description) VALUES (20,'BLR','Belarus');   
go                                 
INSERT INTO Country (Country_Id,Code,Description) VALUES (21,'BEL','Belgium');  
go                                  
INSERT INTO Country (Country_Id,Code,Description) VALUES (22,'BLZ','Belize');    
go                                   
INSERT INTO Country (Country_Id,Code,Description) VALUES (23,'BEN','Benin');  
go                                      
INSERT INTO Country (Country_Id,Code,Description) VALUES (24,'BMU','Bermuda');  
go                                
INSERT INTO Country (Country_Id,Code,Description) VALUES (25,'BTN','Bhutan');                                     
go
INSERT INTO Country (Country_Id,Code,Description) VALUES (26,'BOL','Bolivia');  
go                                   
INSERT INTO Country (Country_Id,Code,Description) VALUES (27,'BOH','Bosnia and Herzegovina'); 
go                 
INSERT INTO Country (Country_Id,Code,Description) VALUES (28,'BWA','Botswana');  
go                             
INSERT INTO Country (Country_Id,Code,Description) VALUES (29,'BVT','Bouvet Island');  
go                       
INSERT INTO Country (Country_Id,Code,Description) VALUES (30,'BRA','Brazil');       
go                                
INSERT INTO Country (Country_Id,Code,Description) VALUES (31,'BIT','British Indian Ocean Territory');    
go      
INSERT INTO Country (Country_Id,Code,Description) VALUES (32,'BVI','British Virgin Islands'); 
go                       
INSERT INTO Country (Country_Id,Code,Description) VALUES (33,'BRN','Brunei');      
go          
INSERT INTO Country (Country_Id,Code,Description) VALUES (34,'BGR','Bulgaria');   
go                               
INSERT INTO Country (Country_Id,Code,Description) VALUES (35,'BFA','Burkina Faso'); 
go                          
INSERT INTO Country (Country_Id,Code,Description) VALUES (36,'BDI','Burundi');    
go                                
INSERT INTO Country (Country_Id,Code,Description) VALUES (37,'KHM','Cambodia');  
go                              
INSERT INTO Country (Country_Id,Code,Description) VALUES (38,'CMR','Cameroon');  
go                             
INSERT INTO Country (Country_Id,Code,Description) VALUES (39,'CAN','Canada');   
go                                  
INSERT INTO Country (Country_Id,Code,Description) VALUES (40,'CPV','Cape Verde'); 
go                             
INSERT INTO Country (Country_Id,Code,Description) VALUES (41,'CYM','Cayman Islands');  
go                
INSERT INTO Country (Country_Id,Code,Description) VALUES (42,'CAR','Central African Republic');
go                   
INSERT INTO Country (Country_Id,Code,Description) VALUES (43,'TCD','Chad');     
go                                    
INSERT INTO Country (Country_Id,Code,Description) VALUES (44,'CHL','Chile');  
go                                      
INSERT INTO Country (Country_Id,Code,Description) VALUES (45,'CHN','China'); 
go                                      
INSERT INTO Country (Country_Id,Code,Description) VALUES (46,'CXR','Christmas Island'); 
go                  
INSERT INTO Country (Country_Id,Code,Description) VALUES (47,'COI','Cocos Islands'); 
go             
INSERT INTO Country (Country_Id,Code,Description) VALUES (48,'COL','Colombia'); 
go                                
INSERT INTO Country (Country_Id,Code,Description) VALUES (49,'COM','Comoros');  
go                              
INSERT INTO Country (Country_Id,Code,Description) VALUES (50,'COG','Congo');  
go                                    
INSERT INTO Country (Country_Id,Code,Description) VALUES (51,'COK','Cook Islands');    
go                       
INSERT INTO Country (Country_Id,Code,Description) VALUES (52,'CRI','Costa Rica');    
go               
INSERT INTO Country (Country_Id,Code,Description) VALUES (53,'CIV','Cote D''Ivoire');     
go                       
INSERT INTO Country (Country_Id,Code,Description) VALUES (54,'HRV','Croatia');    
go                
INSERT INTO Country (Country_Id,Code,Description) VALUES (55,'CUB','Cuba');     
go                                      
INSERT INTO Country (Country_Id,Code,Description) VALUES (56,'CYP','Cyprus');    
go                                    
INSERT INTO Country (Country_Id,Code,Description) VALUES (57,'CZE','Czech Republic');     
go                   
INSERT INTO Country (Country_Id,Code,Description) VALUES (58,'DNK','Denmark');     
go                               
INSERT INTO Country (Country_Id,Code,Description) VALUES (59,'DJI','Djibouti');    
go                                   
INSERT INTO Country (Country_Id,Code,Description) VALUES (60,'DMA','Dominica');      
go                             
INSERT INTO Country (Country_Id,Code,Description) VALUES (61,'DOM','Dominican Republic');     
go           
INSERT INTO Country (Country_Id,Code,Description) VALUES (62,'TMP','East Timor');    
go                             
INSERT INTO Country (Country_Id,Code,Description) VALUES (63,'ECU','Ecuador');     
go                               
INSERT INTO Country (Country_Id,Code,Description) VALUES (64,'EGY','Egypt');     
go                                     
INSERT INTO Country (Country_Id,Code,Description) VALUES (65,'SLV','El Salvador');     
go                          
INSERT INTO Country (Country_Id,Code,Description) VALUES (66,'GNQ','Equatorial Guinea');     
go             
INSERT INTO Country (Country_Id,Code,Description) VALUES (67,'ERI','Eritrea');          
go                              
INSERT INTO Country (Country_Id,Code,Description) VALUES (68,'EST','Estonia');         
go                             
INSERT INTO Country (Country_Id,Code,Description) VALUES (69,'ETH','Ethiopia');        
go  
INSERT INTO Country (Country_Id,Code,Description) VALUES (70,'FAI','Falkland Islands');    
go                            
INSERT INTO Country (Country_Id,Code,Description) VALUES (71,'FRO','Faroe Islands');      
go                   
INSERT INTO Country (Country_Id,Code,Description) VALUES (72,'FJI','Fiji');      
go                                          
INSERT INTO Country (Country_Id,Code,Description) VALUES (73,'FIN','Finland');        
go                               
INSERT INTO Country (Country_Id,Code,Description) VALUES (74,'FRA','France');      
go                                  
INSERT INTO Country (Country_Id,Code,Description) VALUES (75,'GUF','French Guiana');      
go                    
INSERT INTO Country (Country_Id,Code,Description) VALUES (76,'PYF','French Polynesia');  
go
INSERT INTO Country (Country_Id,Code,Description) VALUES (77,'FST','French Southern Territories');       
go        
INSERT INTO Country (Country_Id,Code,Description) VALUES (78,'GAB','Gabon');      
go                                   
INSERT INTO Country (Country_Id,Code,Description) VALUES (79,'GMB','Gambia');    
go                                   
INSERT INTO Country (Country_Id,Code,Description) VALUES (80,'GEO','Georgia');    
go                                 
INSERT INTO Country (Country_Id,Code,Description) VALUES (81,'DEU','Germany');    
go                                 
INSERT INTO Country (Country_Id,Code,Description) VALUES (82,'GHA','Ghana');      
go                                   
INSERT INTO Country (Country_Id,Code,Description) VALUES (83,'GIB','Gibraltar');    
go                               
INSERT INTO Country (Country_Id,Code,Description) VALUES (84,'GRC','Greece');      
go                                 
INSERT INTO Country (Country_Id,Code,Description) VALUES (85,'GRL','Greenland');       
go                          
INSERT INTO Country (Country_Id,Code,Description) VALUES (86,'GRD','Grenada');      
go                               
INSERT INTO Country (Country_Id,Code,Description) VALUES (87,'GLP','Huadeloupe');     
go                          
INSERT INTO Country (Country_Id,Code,Description) VALUES (88,'GUM','Guam');       
go                                   
INSERT INTO Country (Country_Id,Code,Description) VALUES (89,'GTM','Guatemala');       
go                          
INSERT INTO Country (Country_Id,Code,Description) VALUES (90,'GIN','Guinea');         
go                               
INSERT INTO Country (Country_Id,Code,Description) VALUES (91,'GNB','Guinea-Bissau');    
go                       
INSERT INTO Country (Country_Id,Code,Description) VALUES (92,'GUY','Guyana');       
go                                
INSERT INTO Country (Country_Id,Code,Description) VALUES (93,'HTI','Haiti');        
go         
INSERT INTO Country (Country_Id,Code,Description) VALUES (94,'HMI','Heard and McDonald Islands');    
go         
INSERT INTO Country (Country_Id,Code,Description) VALUES (95,'HND','Honduras');    
go                              
INSERT INTO Country (Country_Id,Code,Description) VALUES (96,'HKG','Hong Kong');      
go                          
INSERT INTO Country (Country_Id,Code,Description) VALUES (97,'HUN','Hungary');     
go                               
INSERT INTO Country (Country_Id,Code,Description) VALUES (98,'ISL','Iceland');     
go                                  
INSERT INTO Country (Country_Id,Code,Description) VALUES (99,'IND','India');       
go                                    
INSERT INTO Country (Country_Id,Code,Description) VALUES (100,'IDN','Indonesia');     
go       
INSERT INTO Country (Country_Id,Code,Description) VALUES (101,'IRN','Iran');      
go    
INSERT INTO Country (Country_Id,Code,Description) VALUES (102,'IRQ','Iraq');    
go                                        
INSERT INTO Country (Country_Id,Code,Description) VALUES (103,'IRL','Ireland');    
go                                   
INSERT INTO Country (Country_Id,Code,Description) VALUES (104,'ISR','Israel');   
go                                       
INSERT INTO Country (Country_Id,Code,Description) VALUES (105,'ITA','Italy');     
go                                       
INSERT INTO Country (Country_Id,Code,Description) VALUES (106,'JAM','Jamaica');     
go                                  
INSERT INTO Country (Country_Id,Code,Description) VALUES (107,'JPN','Japan');    
go                                       
INSERT INTO Country (Country_Id,Code,Description) VALUES (108,'JOR','Jordan');       
go                                 
INSERT INTO Country (Country_Id,Code,Description) VALUES (109,'KAZ','Kazakhstan');     
go                           
INSERT INTO Country (Country_Id,Code,Description) VALUES (110,'KEN','Kenya');         
go                                 
INSERT INTO Country (Country_Id,Code,Description) VALUES (111,'KIR','Kiribati');      
go                                 
INSERT INTO Country (Country_Id,Code,Description) VALUES (112,'KON','Korea, North');    
go              
INSERT INTO Country (Country_Id,Code,Description) VALUES (113,'KOS','Korea, South');    
go              
INSERT INTO Country (Country_Id,Code,Description) VALUES (114,'KWT','Kuwait');      
go                                
INSERT INTO Country (Country_Id,Code,Description) VALUES (115,'KGZ','Kyrgyzstan');    
go   
INSERT INTO Country (Country_Id,Code,Description) VALUES (116,'LAO','Laos');     
go                                           
INSERT INTO Country (Country_Id,Code,Description) VALUES (117,'LVA','Latvia');      
go                                   
INSERT INTO Country (Country_Id,Code,Description) VALUES (118,'LBN','Lebanon');    
go                                 
INSERT INTO Country (Country_Id,Code,Description) VALUES (119,'LSO','Lesotho');    
go                                 
INSERT INTO Country (Country_Id,Code,Description) VALUES (120,'LBR','Liberia');     
go         
INSERT INTO Country (Country_Id,Code,Description) VALUES (121,'LIB','Libya');     
go                                           
INSERT INTO Country (Country_Id,Code,Description) VALUES (122,'LIE','Liechtenstein');    
go                        
INSERT INTO Country (Country_Id,Code,Description) VALUES (123,'LTU','Lithuania');    
go                               
INSERT INTO Country (Country_Id,Code,Description) VALUES (124,'LUX','Luxembourg');    
go                          
INSERT INTO Country (Country_Id,Code,Description) VALUES (125,'MAC','Macau');   
go
INSERT INTO Country (Country_Id,Code,Description) VALUES (126,'MYR','Macedonia, Former Yugoslav Republic of');    
go
INSERT INTO Country (Country_Id,Code,Description) VALUES (127,'MDG','Madagascar');   
go                           
INSERT INTO Country (Country_Id,Code,Description) VALUES (128,'MWI','Malawi');      
go                                
INSERT INTO Country (Country_Id,Code,Description) VALUES (129,'MYS','Malaysia');     
go                               
INSERT INTO Country (Country_Id,Code,Description) VALUES (130,'MDV','Maldives');     
go                              
INSERT INTO Country (Country_Id,Code,Description) VALUES (131,'MLI','Mali');   
go                                          
INSERT INTO Country (Country_Id,Code,Description) VALUES (132,'MLT','Malta');    
go                                      
INSERT INTO Country (Country_Id,Code,Description) VALUES (133,'MHL','Marshall Islands');   
go                  
INSERT INTO Country (Country_Id,Code,Description) VALUES (134,'MTQ','Martinique');    
go                           
INSERT INTO Country (Country_Id,Code,Description) VALUES (135,'MRT','Mauritania');   
go                             
INSERT INTO Country (Country_Id,Code,Description) VALUES (136,'MUS','Mauritius');    
go                              
INSERT INTO Country (Country_Id,Code,Description) VALUES (137,'MYT','Mayotte');    
go                                  
INSERT INTO Country (Country_Id,Code,Description) VALUES (138,'MEX','Mexico');     
go
INSERT INTO Country (Country_Id,Code,Description) VALUES (139,'MFS','Micronesia, Federated States of');    
go  
INSERT INTO Country (Country_Id,Code,Description) VALUES (140,'MDA','Moldova');     
go        
INSERT INTO Country (Country_Id,Code,Description) VALUES (141,'MCO','Monaco');     
go                                
INSERT INTO Country (Country_Id,Code,Description) VALUES (142,'MNG','Mongolia');       
go                           
INSERT INTO Country (Country_Id,Code,Description) VALUES (143,'MSR','Montserrat');      
go                         
INSERT INTO Country (Country_Id,Code,Description) VALUES (144,'MAR','Morocco');      
go                             
INSERT INTO Country (Country_Id,Code,Description) VALUES (145,'MOZ','Mozambique');     
go                        
INSERT INTO Country (Country_Id,Code,Description) VALUES (146,'MMR','Myanmar');    
go                                
INSERT INTO Country (Country_Id,Code,Description) VALUES (147,'NAM','Namibia');      
go                                
INSERT INTO Country (Country_Id,Code,Description) VALUES (148,'NRU','Nauru');        
go                                 
INSERT INTO Country (Country_Id,Code,Description) VALUES (149,'NPL','Nepal');        
go                                  
INSERT INTO Country (Country_Id,Code,Description) VALUES (150,'ANT','Netherlands Antilles');   
go           
INSERT INTO Country (Country_Id,Code,Description) VALUES (151,'NLD','Netherlands');    
go                         
INSERT INTO Country (Country_Id,Code,Description) VALUES (152,'NCL','New Caledonia');    
go                     
INSERT INTO Country (Country_Id,Code,Description) VALUES (153,'NZL','New Zealand');   
go                          
INSERT INTO Country (Country_Id,Code,Description) VALUES (154,'NIC','Nicaragua');   
go                               
INSERT INTO Country (Country_Id,Code,Description) VALUES (155,'NER','Niger');    
go                                      
INSERT INTO Country (Country_Id,Code,Description) VALUES (156,'NGA','Nigeria');   
go                                   
INSERT INTO Country (Country_Id,Code,Description) VALUES (157,'NIU','Niue');   
go                                         
INSERT INTO Country (Country_Id,Code,Description) VALUES (158,'NFK','Norfolk Island');   
go
INSERT INTO Country (Country_Id,Code,Description) VALUES (159,'NMI','Northern Mariana Islands');    
go  
INSERT INTO Country (Country_Id,Code,Description) VALUES (160,'NOR','Norway');    
go                                 
INSERT INTO Country (Country_Id,Code,Description) VALUES (161,'OMN','Oman');   
go                                      
INSERT INTO Country (Country_Id,Code,Description) VALUES (162,'PAK','Pakistan');    
go                                 
INSERT INTO Country (Country_Id,Code,Description) VALUES (163,'PLW','Palau');     
go                                    
INSERT INTO Country (Country_Id,Code,Description) VALUES (164,'PAN','Panama');   
go                                    
INSERT INTO Country (Country_Id,Code,Description) VALUES (165,'PNG','Papua New Guinea');    
go                
INSERT INTO Country (Country_Id,Code,Description) VALUES (166,'PRY','Paraguay');    
go                                
INSERT INTO Country (Country_Id,Code,Description) VALUES (167,'PER','Peru');     
go                                       
INSERT INTO Country (Country_Id,Code,Description) VALUES (168,'PHL','Philippines');     
go                           
INSERT INTO Country (Country_Id,Code,Description) VALUES (169,'PCN','Pitcairn Island');    
go                                
INSERT INTO Country (Country_Id,Code,Description) VALUES (170,'POL','Poland');     
go                                  
INSERT INTO Country (Country_Id,Code,Description) VALUES (171,'PRT','Portugal');     
go                               
INSERT INTO Country (Country_Id,Code,Description) VALUES (172,'PRI','Puerto Rico');     
go                          
INSERT INTO Country (Country_Id,Code,Description) VALUES (173,'QAT','Qatar');      
go                                   
INSERT INTO Country (Country_Id,Code,Description) VALUES (174,'REU','Reunion');      
go                               
INSERT INTO Country (Country_Id,Code,Description) VALUES (175,'ROM','Romania');     
go                               
INSERT INTO Country (Country_Id,Code,Description) VALUES (176,'RUS','Russia');      
go           
INSERT INTO Country (Country_Id,Code,Description) VALUES (177,'RWA','Rwanda');      
go    
INSERT INTO Country (Country_Id,Code,Description) VALUES (178,'GSI','S. Georgia and S. Sandwich Isls.');     
go
INSERT INTO Country (Country_Id,Code,Description) VALUES (179,'SKN','Saint Kitts and Nevis');   
go                        
INSERT INTO Country (Country_Id,Code,Description) VALUES (180,'LCA','Saint Lucia');    
go     
INSERT INTO Country (Country_Id,Code,Description) VALUES (181,'SVG','Saint Vincent and The Grenadines');   
go
INSERT INTO Country (Country_Id,Code,Description) VALUES (182,'WSM','Samoa');     
go                                  
INSERT INTO Country (Country_Id,Code,Description) VALUES (183,'SMR','San Marino');       
go       
INSERT INTO Country (Country_Id,Code,Description) VALUES (184,'STP','Sao Tome and Principe');    
go                
INSERT INTO Country (Country_Id,Code,Description) VALUES (185,'SAU','Saudi Arabia');     
go                         
INSERT INTO Country (Country_Id,Code,Description) VALUES (186,'SEN','Senegal');     
go                                
INSERT INTO Country (Country_Id,Code,Description) VALUES (187,'SYC','Seychelles');     
go                           
INSERT INTO Country (Country_Id,Code,Description) VALUES (188,'SLE','Sierra Leone');    
go                         
INSERT INTO Country (Country_Id,Code,Description) VALUES (189,'SGP','Singapore');   
go                              
INSERT INTO Country (Country_Id,Code,Description) VALUES (190,'SVK','Slovakia');      
go                              
INSERT INTO Country (Country_Id,Code,Description) VALUES (191,'SVN','Slovenia');    
go                                
INSERT INTO Country (Country_Id,Code,Description) VALUES (192,'SLB','Solomon Islands');     
go                 
INSERT INTO Country (Country_Id,Code,Description) VALUES (193,'SOM','Somalia');     
go                                
INSERT INTO Country (Country_Id,Code,Description) VALUES (194,'ZAF','South Africa');      
go                       
INSERT INTO Country (Country_Id,Code,Description) VALUES (195,'ESP','Spain');   
go                                       
INSERT INTO Country (Country_Id,Code,Description) VALUES (196,'LKA','Sri Lanka');                                  
go
INSERT INTO Country (Country_Id,Code,Description) VALUES (197,'SHN','St. Helena');   
go
INSERT INTO Country (Country_Id,Code,Description) VALUES (198,'SPM','St. Pierre and Miquelon');                 
go
INSERT INTO Country (Country_Id,Code,Description) VALUES (199,'SDN','Sudan');                                       
go
INSERT INTO Country (Country_Id,Code,Description) VALUES (200,'SUR','Suriname');     
go
INSERT INTO Country (Country_Id,Code,Description) VALUES (201,'SJM','Svalbard and Jan Mayen Islands');   
go
INSERT INTO Country (Country_Id,Code,Description) VALUES (202,'SWZ','Swaziland');                              
go
INSERT INTO Country (Country_Id,Code,Description) VALUES (203,'SWE','Sweden');                                   
go
INSERT INTO Country (Country_Id,Code,Description) VALUES (204,'CHE','Switzerland');         
go
INSERT INTO Country (Country_Id,Code,Description) VALUES (205,'SYR','Syria');             
go
INSERT INTO Country (Country_Id,Code,Description) VALUES (206,'TAI','Taiwan');                                           
go
INSERT INTO Country (Country_Id,Code,Description) VALUES (207,'TJK','Tajikistan');                                 
go
INSERT INTO Country (Country_Id,Code,Description) VALUES (208,'TAN','Tanzania');                                        
go
INSERT INTO Country (Country_Id,Code,Description) VALUES (209,'THA','Thailand');                                  
go
INSERT INTO Country (Country_Id,Code,Description) VALUES (210,'TGO','Togo');                                        
go
INSERT INTO Country (Country_Id,Code,Description) VALUES (211,'TKL','Tokelau');                                    
go
INSERT INTO Country (Country_Id,Code,Description) VALUES (212,'TON','Tonga');                                       
go
INSERT INTO Country (Country_Id,Code,Description) VALUES (213,'TTO','Trinidad and Tobago');             
go
INSERT INTO Country (Country_Id,Code,Description) VALUES (214,'TUN','Tunisia');                                     
go
INSERT INTO Country (Country_Id,Code,Description) VALUES (215,'TUR','Turkey');                                      
go
INSERT INTO Country (Country_Id,Code,Description) VALUES (216,'TKM','Turkmenistan');      
go
INSERT INTO Country (Country_Id,Code,Description) VALUES (217,'TCI','Turks and Caicos Islands');               
go
INSERT INTO Country (Country_Id,Code,Description) VALUES (218,'TUV','Tuvalu');    
go
INSERT INTO Country (Country_Id,Code,Description) VALUES (219,'MOI','U.S. Minor Outlying Islands');            
go
INSERT INTO Country (Country_Id,Code,Description) VALUES (220,'UGA','Uganda');                                    
go
INSERT INTO Country (Country_Id,Code,Description) VALUES (221,'UKR','Ukraine');                                    
go
INSERT INTO Country (Country_Id,Code,Description) VALUES (222,'ARE','United Arab Emirates');             
go
INSERT INTO Country (Country_Id,Code,Description) VALUES (223,'GBR','United Kingdom');                      
go
INSERT INTO Country (Country_Id,Code,Description) VALUES (224,'USA','United States');
go
INSERT INTO Country (Country_Id,Code,Description) VALUES (225,'UVI','US Virgin Islands');                                 
go
INSERT INTO Country (Country_Id,Code,Description) VALUES (226,'URY','Uruguay');                                   
go
INSERT INTO Country (Country_Id,Code,Description) VALUES (227,'UZB','Uzbekistan');                              
go
INSERT INTO Country (Country_Id,Code,Description) VALUES (228,'VUT','Vanuatu');     
go
INSERT INTO Country (Country_Id,Code,Description) VALUES (229,'VCY','Vatican City');                                   
go
INSERT INTO Country (Country_Id,Code,Description) VALUES (230,'VEN','Venezuela');                               
go
INSERT INTO Country (Country_Id,Code,Description) VALUES (231,'VNM','Vietnam');       
go
INSERT INTO Country (Country_Id,Code,Description) VALUES (232,'WFI','Wallis and Futuna Islands');             
go
INSERT INTO Country (Country_Id,Code,Description) VALUES (233,'ESH','Western Sahara');                     
go
INSERT INTO Country (Country_Id,Code,Description) VALUES (234,'YEM','Yemen');                                       
go
INSERT INTO Country (Country_Id,Code,Description) VALUES (235,'YUG','Yugoslavia');                              
go
INSERT INTO Country (Country_Id,Code,Description) VALUES (236,'ZAI','Zaire');                                              
go
INSERT INTO Country (Country_Id,Code,Description) VALUES (237,'ZMB','Zambia');                                      
go
INSERT INTO Country (Country_Id,Code,Description) VALUES (238,'ZWE','Zimbabwe'); 
go


--State
CREATE TABLE State (
State_Id integer IDENTITY,
Description varchar (50) NOT NULL ,
Country_Id integer
);
GO

ALTER TABLE State
ADD CONSTRAINT PK_State
PRIMARY KEY (State_Id);
GO

ALTER TABLE State 
ADD CONSTRAINT FK_State_Country
FOREIGN KEY (Country_Id)
REFERENCES Country(Country_Id);
GO


-- UserType
CREATE TABLE UserType (
UserType_Id integer IDENTITY,
Description varchar(200) NOT NULL,
Parent_Id integer
);
GO

ALTER TABLE UserType
ADD CONSTRAINT PK_UserType
PRIMARY KEY (UserType_Id);
GO

ALTER TABLE UserType
ADD CONSTRAINT FK_UserType_UserType
FOREIGN KEY (Parent_Id) 
REFERENCES UserType(UserType_Id );
GO

INSERT INTO UserType (Description,Parent_Id )
VALUES('Normal',NULL);

INSERT INTO UserType (Description,Parent_Id )
VALUES('Artist',NULL);

INSERT INTO UserType (Description,Parent_Id )
VALUES('Registered',1);

INSERT INTO UserType (Description,Parent_Id )
VALUES('Guest',1);

-- User
CREATE TABLE User_Table (
User_Id integer IDENTITY,
Username varchar(50) NOT NULL UNIQUE,
First_Name varchar(50) NOT NULL,
Password varchar(20) NOT NULL,
Last_Name varchar(50),
Middle_Name varchar(50),
Date_of_Birth datetime,
UserType_Id integer,
Status_Id integer,
Operation_Id integer,
Create_Time datetime,
Update_Time datetime
);
GO

ALTER TABLE User_Table
ADD CONSTRAINT PK_User
PRIMARY KEY (User_Id);
GO

ALTER TABLE User_Table
ADD CONSTRAINT FK_User_UserType
FOREIGN KEY (UserType_Id) 
REFERENCES UserType (UserType_Id) 
GO

ALTER TABLE User_Table
ADD CONSTRAINT FK_User_Status
FOREIGN KEY (Status_Id)
REFERENCES Status(Status_Id);
GO

ALTER TABLE User_Table
ADD CONSTRAINT FK_User_Operation
FOREIGN KEY (Operation_Id)
REFERENCES Operation(Operation_Id);
GO

ALTER TABLE User_Table 
ADD CONSTRAINT DEF_User_CreateTime
DEFAULT getDate() FOR Create_Time;
GO

-- Organization
CREATE TABLE OrganizationType (
OrganizationType_Id integer IDENTITY ,
Description varchar(100) NOT NULL
);
GO

ALTER TABLE OrganizationType
ADD CONSTRAINT PK_OrganizationType
PRIMARY KEY (OrganizationType_Id);
GO

CREATE TABLE Organization (
Organization_Id integer IDENTITY,
Description varchar(200),
Status_Id integer,
Operation_Id integer,
User_Id integer,
Create_Time datetime,
Update_Time datetime
);
GO

ALTER TABLE Organization
ADD CONSTRAINT PK_Organization
PRIMARY KEY (Organization_Id);
GO

ALTER TABLE Organization
ADD CONSTRAINT FK_Organization_Status
FOREIGN KEY (Status_Id)
REFERENCES Status(Status_Id);
GO

ALTER TABLE Organization
ADD CONSTRAINT FK_Organization_Operation
FOREIGN KEY (Operation_Id)
REFERENCES Operation(Operation_Id);
GO

ALTER TABLE Organization
ADD CONSTRAINT FK_Organization_User
FOREIGN KEY (User_Id)
REFERENCES User_Table(User_Id);
GO

ALTER TABLE Organization 
ADD CONSTRAINT DEF_Organization_CreateTime
DEFAULT getDate() FOR Create_Time;
GO

-- User_Organization
CREATE TABLE User_Organization (
User_Organization_Id integer IDENTITY,
User_Id integer NOT NULL,
Organization_Id integer NOT NULL,
Status_Id integer,
Operation_Id integer,
Create_Time datetime,
Update_Time datetime
);
GO

ALTER TABLE User_Organization
ADD CONSTRAINT PK_User_Organization
PRIMARY KEY (User_Organization_Id);
GO

ALTER TABLE User_Organization
ADD CONSTRAINT FK_UserOrganization_User
FOREIGN KEY (User_Id)
REFERENCES User_Table(User_Id);
GO

ALTER TABLE User_Organization
ADD CONSTRAINT FK_UserOrganization_Org
FOREIGN KEY (Organization_Id)
REFERENCES Organization(Organization_Id);
GO

ALTER TABLE User_Organization
ADD CONSTRAINT FK_UserOrganization_Status
FOREIGN KEY (Status_Id)
REFERENCES Status(Status_Id);
GO

ALTER TABLE User_Organization
ADD CONSTRAINT FK_UserOrganization_Operation
FOREIGN KEY (Operation_Id)
REFERENCES Operation(Operation_Id);
GO

ALTER TABLE User_Organization
ADD CONSTRAINT DEF_UserOrganization_CT
DEFAULT getDate() FOR Create_Time;
GO

-- LocationType
CREATE TABLE LocationType (
LocationType_Id integer IDENTITY,
Description varchar(100) NOT NULL
);
GO

ALTER TABLE LocationType
ADD CONSTRAINT PK_LocationType
PRIMARY KEY (LocationType_Id);
GO

-- Location
CREATE TABLE Location (
Location_Id integer IDENTITY,
Address1 varchar(500),
Address2 varchar(500),
Street	varchar(100),
City	varchar(50),
State_Id	integer,
Country_Id integer,
Zip varchar(50),
Phone varchar(100),
Email varchar(100),
User_Id integer,
Status_Id integer,
Operation_Id integer,
Create_Time datetime,
Update_Time datetime
);
GO

ALTER TABLE Location
ADD CONSTRAINT PK_Location
PRIMARY KEY (Location_Id);
GO

ALTER TABLE Location
ADD CONSTRAINT FK_Location_State
FOREIGN KEY (State_Id) 
REFERENCES State (State_Id) 
GO

ALTER TABLE Location
ADD CONSTRAINT FK_Location_Country
FOREIGN KEY (Country_Id) 
REFERENCES Country (Country_Id) 
GO

ALTER TABLE Location
ADD CONSTRAINT FK_Location_User
FOREIGN KEY (User_Id) 
REFERENCES User_Table (User_Id) 
GO


ALTER TABLE Location
ADD CONSTRAINT FK_Location_Status
FOREIGN KEY (Status_Id)
REFERENCES Status(Status_Id);
GO

ALTER TABLE Location
ADD CONSTRAINT FK_Location_Operation
FOREIGN KEY (Operation_Id)
REFERENCES Operation(Operation_Id);
GO

ALTER TABLE Location
ADD CONSTRAINT DEF_Location_CT
DEFAULT getDate() FOR Create_Time;
GO

--User_Location
CREATE TABLE User_Location (
User_Location_Id integer IDENTITY,
User_Id integer NOT NULL,
Location_Id integer NOT NULL,
LocationType_Id integer NOT NULL,
SubmittedBy_Id integer,
Status_Id integer,
Operation_Id integer,
Create_Time datetime,
Update_Time datetime
);
GO

ALTER TABLE User_Location
ADD CONSTRAINT PK_User_Location
PRIMARY KEY (User_Location_Id);
GO

ALTER TABLE User_Location 
ADD CONSTRAINT FK_UserLocation_User
FOREIGN KEY (User_Id)
REFERENCES User_Table(User_Id);
GO

ALTER TABLE User_Location 
ADD CONSTRAINT FK_UserLocation_Location
FOREIGN KEY (Location_Id)
REFERENCES Location(Location_Id);
GO

ALTER TABLE User_Location 
ADD CONSTRAINT FK_UserLocation_Type
FOREIGN KEY (LocationType_Id)
REFERENCES LocationType(LocationType_Id);
GO

ALTER TABLE User_Location 
ADD CONSTRAINT FK_UserLocation_Submitted
FOREIGN KEY (SubmittedBy_Id)
REFERENCES User_Table(User_Id);
GO

ALTER TABLE User_Location
ADD CONSTRAINT FK_User_Location_Operation
FOREIGN KEY (Operation_Id)
REFERENCES Operation(Operation_Id);
GO

ALTER TABLE User_Location
ADD CONSTRAINT FK_User_Location_Status
FOREIGN KEY (Status_Id)
REFERENCES Status(Status_Id);
GO

ALTER TABLE User_Location
ADD CONSTRAINT DEF_UserLocation_CT
DEFAULT getDate() FOR Create_Time;
GO

-- Category
CREATE TABLE Category (
Category_Id integer IDENTITY,
Description varchar(100) NOT NULL,
User_Id integer,
Status_Id integer,
Operation_Id integer,
Create_Time datetime,
Update_Time datetime
);
GO

ALTER TABLE Category
ADD CONSTRAINT PK_Category
PRIMARY KEY (Category_Id);
GO

ALTER TABLE Category
ADD CONSTRAINT FK_Category_User
FOREIGN KEY (User_Id) 
REFERENCES User_Table (User_Id) 
GO

ALTER TABLE Category
ADD CONSTRAINT FK_Category_Status
FOREIGN KEY (Status_Id)
REFERENCES Status(Status_Id);
GO

ALTER TABLE Category
ADD CONSTRAINT FK_Category_Operation
FOREIGN KEY (Operation_Id)
REFERENCES Operation(Operation_Id);
GO

ALTER TABLE Category
ADD CONSTRAINT DEF_Category_CT
DEFAULT getDate() FOR Create_Time;
GO

-- Theme
CREATE TABLE Theme (
Theme_Id integer IDENTITY,
Description varchar(100) NOT NULL,
User_Id integer,
Status_Id integer,
Operation_Id integer,
Create_Time datetime,
Update_Time datetime
);
GO

ALTER TABLE Theme
ADD CONSTRAINT PK_Theme
PRIMARY KEY (Theme_Id);
GO

ALTER TABLE Theme
ADD CONSTRAINT FK_Theme_User
FOREIGN KEY (User_Id) 
REFERENCES User_Table (User_Id) 
GO

ALTER TABLE Theme
ADD CONSTRAINT FK_Theme_Status
FOREIGN KEY (Status_Id)
REFERENCES Status(Status_Id);
GO

ALTER TABLE Theme
ADD CONSTRAINT FK_Theme_Operation
FOREIGN KEY (Operation_Id)
REFERENCES Operation(Operation_Id);
GO

ALTER TABLE Theme
ADD CONSTRAINT DEF_Theme_CT
DEFAULT getDate() FOR Create_Time;
GO

-- Unit
CREATE TABLE Unit (
Unit_Id integer IDENTITY,
Description varchar(40) NOT NULL,
Symbol varchar(10) NOT NULL
);
GO

ALTER TABLE Unit
ADD CONSTRAINT PK_Unit
PRIMARY KEY (Unit_Id);
GO

-- Dimension
CREATE TABLE Dimension (
Dimension_Id integer IDENTITY,
Width integer NOT NULL,
Height integer NOT NULL,
Unit_Id integer NOT NULL
);
GO

ALTER TABLE Dimension
ADD CONSTRAINT PK_Dimension
PRIMARY KEY (Dimension_Id);
GO

ALTER TABLE Dimension
ADD CONSTRAINT FK_Dimension_Unit
FOREIGN KEY (Unit_Id) 
REFERENCES Unit (Unit_Id) 
GO

-- Currency
CREATE TABLE Currency (
Currency_Id integer IDENTITY,
Description varchar(40) NOT NULL,
Symbol varchar(10) NOT NULL
);
GO

ALTER TABLE Currency
ADD CONSTRAINT PK_Currency
PRIMARY KEY (Currency_Id);
GO

-- Item
CREATE TABLE Item (
Item_Id integer IDENTITY,
Description varchar(4000),
Category_Id integer,
Theme_Id integer,
Date_of_creation datetime,
Dimension_Id integer,
Proposed_Cost integer,
Currency_Id integer,
User_Id integer,
Status_Id integer,
Operation_Id integer,
Create_Time datetime,
Update_Time datetime
);
GO

ALTER TABLE Item
ADD CONSTRAINT PK_Item
PRIMARY KEY (Item_Id);
GO

ALTER TABLE Item
ADD CONSTRAINT FK_Item_Category
FOREIGN KEY (Category_Id) 
REFERENCES Category (Category_Id) 
GO

ALTER TABLE Item
ADD CONSTRAINT FK_Item_Theme
FOREIGN KEY (Theme_Id) 
REFERENCES Theme (Theme_Id) 
GO

ALTER TABLE Item
ADD CONSTRAINT FK_Item_Dimension
FOREIGN KEY (Dimension_Id) 
REFERENCES Dimension (Dimension_Id) 
GO

ALTER TABLE Item
ADD CONSTRAINT FK_Item_Currency
FOREIGN KEY (Currency_Id) 
REFERENCES Currency (Currency_Id) 
GO

ALTER TABLE Item
ADD CONSTRAINT FK_Item_User
FOREIGN KEY (User_Id) 
REFERENCES User_Table (User_Id) 
GO


ALTER TABLE Item
ADD CONSTRAINT FK_Item_Status
FOREIGN KEY (Status_Id)
REFERENCES Status(Status_Id);
GO

ALTER TABLE Item
ADD Rating_Id int ;
GO

ALTER TABLE Item
ADD CONSTRAINT FK_Item_Rating
FOREIGN KEY (Rating_Id) 
REFERENCES Rating (Rating_Id) 
GO

ALTER TABLE Item
ADD CONSTRAINT DEF_Item_Rating
DEFAULT 0 FOR Rating_Id;
GO

ALTER TABLE Item
ADD CONSTRAINT FK_Item_Operation
FOREIGN KEY (Operation_Id)
REFERENCES Operation(Operation_Id);
GO

ALTER TABLE Item
ADD CONSTRAINT DEF_Item_CT
DEFAULT getDate() FOR Create_Time;
GO
CREATE TABLE DocumentType (
DocumentType_Id integer IDENTITY ,
Description varchar(100) NOT NULL
);
GO

ALTER TABLE DocumentType
ADD CONSTRAINT PK_DocumentType_Id
PRIMARY KEY (DocumentType_Id);
GO

CREATE TABLE UserDocument (
UserDocument_Id integer IDENTITY,
User_Id integer,
DocumentType_Id integer,
Status_Id integer,
Operation_Id integer,
Create_Time datetime,
Update_Time datetime
);
GO

ALTER TABLE UserDocument
ADD CONSTRAINT PK_UserDocument
PRIMARY KEY (UserDocument_Id);
GO

ALTER TABLE UserDocument
ADD CONSTRAINT FK_UserDocument_User
FOREIGN KEY (User_Id)
REFERENCES User_Table(User_Id);
GO

ALTER TABLE UserDocument
ADD CONSTRAINT FK_DocumentType_Id
FOREIGN KEY (DocumentType_Id)
REFERENCES DocumentType(DocumentType_Id);
GO

ALTER TABLE UserDocument
ADD CONSTRAINT FK_UserDocument_Status
FOREIGN KEY (Status_Id)
REFERENCES Status(Status_Id);
GO

ALTER TABLE UserDocument
ADD CONSTRAINT FK_UserDocument_Operation
FOREIGN KEY (Operation_Id)
REFERENCES Operation(Operation_Id);
GO

CREATE TABLE PaymentMode (
PaymentMode_Id integer IDENTITY ,
Description varchar(100) NOT NULL,
Status_Id integer,
User_Id integer,
Operation_Id integer,
Create_Time datetime,
Update_Time datetime
);
GO

ALTER TABLE PaymentMode
ADD CONSTRAINT PK_PaymentMode
PRIMARY KEY (PaymentMode_Id);
GO

ALTER TABLE PaymentMode
ADD CONSTRAINT FK_PaymentMode_Status
FOREIGN KEY (Status_Id)
REFERENCES Status(Status_Id);
GO

ALTER TABLE PaymentMode
ADD CONSTRAINT FK_PaymentMode_Operation
FOREIGN KEY (Operation_Id)
REFERENCES Operation(Operation_Id);
GO

ALTER TABLE PaymentMode
ADD CONSTRAINT FK_PaymentMode_User
FOREIGN KEY (User_Id)
REFERENCES User_Table(User_Id);
GO


CREATE TABLE Bank (
Bank_Id integer IDENTITY ,
Description varchar(200) NOT NULL,
Status_Id integer,
User_Id integer,
Operation_Id integer,
Create_Time datetime,
Update_Time datetime
);
GO

ALTER TABLE Bank
ADD CONSTRAINT PK_Bank
PRIMARY KEY (Bank_Id);
GO

ALTER TABLE Bank
ADD CONSTRAINT FK_Bank_Status
FOREIGN KEY (Status_Id)
REFERENCES Status(Status_Id);
GO

ALTER TABLE Bank
ADD CONSTRAINT FK_Bank_Operation
FOREIGN KEY (Operation_Id)
REFERENCES Operation(Operation_Id);
GO

ALTER TABLE Bank
ADD CONSTRAINT FK_Bank_User
FOREIGN KEY (User_Id)
REFERENCES User_Table(User_Id);
GO


CREATE TABLE Bank_PaymentMode(
Bank_PaymentMode_Id integer IDENTITY ,
Bank_Id integer NOT NULL,
PaymentMode_Id integer NOT NULL,
User_Id integer,
Status_Id integer,
Operation_Id integer,
Create_Time datetime,
Update_Time datetime
);
GO

ALTER TABLE Bank_PaymentMode
ADD CONSTRAINT PK_Bank_PaymentMode
PRIMARY KEY (Bank_PaymentMode_Id);
GO

ALTER TABLE Bank_PaymentMode
ADD CONSTRAINT FK_Bank_PaymentMode_PM_Id
FOREIGN KEY (PaymentMode_Id)
REFERENCES PaymentMode(PaymentMode_Id);
GO

ALTER TABLE Bank_PaymentMode
ADD CONSTRAINT FK_Bank_PaymentMode_Bank_Id
FOREIGN KEY (Bank_Id)
REFERENCES Bank(Bank_Id);
GO

ALTER TABLE Bank_PaymentMode
ADD CONSTRAINT FK_Bank_PaymentMode_Status
FOREIGN KEY (Status_Id)
REFERENCES Status(Status_Id);
GO

ALTER TABLE Bank_PaymentMode
ADD CONSTRAINT FK_Bank_PaymentMode_Operation
FOREIGN KEY (Operation_Id)
REFERENCES Operation(Operation_Id);
GO

ALTER TABLE Bank_PaymentMode
ADD CONSTRAINT FK_Bank_PaymentMode_User
FOREIGN KEY (User_Id)
REFERENCES User_Table(User_Id);
GO



CREATE TABLE ContactType (
ContactType_Id integer IDENTITY ,
Description varchar(100) NOT NULL
);
GO

ALTER TABLE ContactType
ADD CONSTRAINT PK_ContactType
PRIMARY KEY (ContactType_Id);
GO

CREATE TABLE UserContact (
UserContact_Id integer IDENTITY,
Description integer,
ContactType_Id integer,
User_Id integer,
Status_Id integer,
Operation_Id integer,
Create_Time datetime,
Update_Time datetime
);
GO

ALTER TABLE UserContact
ADD CONSTRAINT PK_UserContact
PRIMARY KEY (UserContact_Id);
GO

ALTER TABLE UserContact
ADD CONSTRAINT FK_UserContact_User
FOREIGN KEY (User_Id)
REFERENCES User_Table(User_Id);
GO

ALTER TABLE UserContact
ADD CONSTRAINT FK_ContactType_Id
FOREIGN KEY (ContactType_Id)
REFERENCES ContactType(ContactType_Id);
GO

ALTER TABLE UserContact
ADD CONSTRAINT FK_UserContact_Status
FOREIGN KEY (Status_Id)
REFERENCES Status(Status_Id);
GO

ALTER TABLE UserContact
ADD CONSTRAINT FK_UserContact_Operation
FOREIGN KEY (Operation_Id)
REFERENCES Operation(Operation_Id);
GO



CREATE TABLE EmailType (
EmailType_Id integer IDENTITY ,
Description varchar(100) NOT NULL
);
GO

ALTER TABLE EmailType
ADD CONSTRAINT PK_EmailType_Id
PRIMARY KEY (EmailType_Id);
GO



CREATE TABLE UserEmail (
UserEmail_Id integer IDENTITY,
Email_Address varchar(200),
Account_Provider varchar(200),
User_Id integer,
Status_Id integer,
Operation_Id integer,
Create_Time datetime,
Update_Time datetime
);
GO

ALTER TABLE UserEmail
ADD CONSTRAINT PK_UserEmail
PRIMARY KEY (UserEmail_Id);
GO

ALTER TABLE UserEmail
ADD CONSTRAINT FK_User_Id
FOREIGN KEY (User_id)
REFERENCES User_Table(User_id);
GO

ALTER TABLE UserEmail
ADD CONSTRAINT FK_UserEmail_Status
FOREIGN KEY (Status_Id)
REFERENCES Status(Status_Id);
GO

ALTER TABLE UserEmail
ADD CONSTRAINT FK_UserEmail_Operation
FOREIGN KEY (Operation_Id)
REFERENCES Operation(Operation_Id);
GO

INSERT INTO User_Table VALUES ('admin','admin','admin','admin',getdate(),1,0,1,getdate(),getdate());
INSERT INTO User_Table VALUES ('user','user','user','user',getdate(),4,0,1,getdate(),getdate());=======


ALTER TABLE Theme
ADD Category_Id INTEGER;
GO

ALTER TABLE Theme
ADD CONSTRAINT FK_Theme_Category_Id
FOREIGN KEY (Category_Id)
REFERENCES Category(Category_Id);
GO
